<template>
	<view class="pages-box rel">
		<!-- #ifndef H5 -->
		<uni-nav-bar :fixed="true" :shadow="false" :statusBar="true" title="公司资产" leftIcon="icon-left"
			color="#ffffff" :backgroundColor="primaryColor">
		</uni-nav-bar>
		<view :style="{height:`${configInfo.navBarHeight}px`}"></view>
		<!-- #endif -->
		<block v-if="isLoad">
			<view @tap.stop="$util.goUrl({url:`/user/pages/cash-out?type=distribution`})" class="mine-menu-list c-base"
				:style="{background:primaryColor}">
				<view class="space-lg"></view>
				<view class="space-lg"></view>
				<view class="flex-between pl-lg pr-lg">
					<view class="" v-for="(item,index) in tabList" :key="index">
						<view class="flex-center">{{item.name}}</view>
						<view class="flex-center f-title text-bold pt-sm">{{detail[item.type]}}</view>
					</view>
				</view>
				<view class="space-lg"></view>
				<view class="space-lg"></view>
				<view class="flex-center pl-lg pr-lg ml-md mr-md">
					<view class="cash-out-btn flex-center fill-base f-title text-bold flex-1" :style="{color: primaryColor}"
					@tap="$util.goUrl({url: `/user/pages/limit/recharge`})">额度申请</view>
					<view class="cash-out-btn flex-center fill-base f-title text-bold flex-1 ml-lg" :style="{color: primaryColor}"
					@tap="$util.goUrl({url: `/user/pages/wallet/payment`})">充值</view>
					<view class="cash-out-btn flex-center fill-base f-title text-bold flex-1 ml-lg" :style="{color: primaryColor}"
					@tap="$util.goUrl({url: `/user/pages/stored/index?type=2`})">钱包</view>
				</view>
				
				<view class="space-lg"></view>
				<view class="space-lg"></view>
			</view>
			<view @tap.stop="$util.goUrl({url:`/user/pages/wallet/water`})"
				class="flex-between mt-md pt-lg pb-lg pl-lg pr-md fill-base">
				<view class="f-title c-title">账户消耗明细</view>
				<view class="flex-y-center f-paragraph c-title">
					<view class="c-warning" v-if="detail.extract_ing_price*1>0">提现中 {{detail.extract_ing_price}}元</view>
					<i class="iconfont icon-right ml-sm"></i>
				</view>
			</view> 
			<view @tap.stop="$util.goUrl({url:`/user/pages/wallet/recharge`})"
				class="flex-between pt-lg pb-lg pl-lg pr-md fill-base b-1px-t">
				<view class="f-title c-title">充值记录</view>
				<view class="flex-y-center f-paragraph c-title">
					<i class="iconfont icon-right ml-sm"></i>
				</view>
			</view>
			<view @tap.stop="$util.goUrl({url:`/user/pages/limit/manage`})"
				class="flex-between pt-lg pb-lg pl-lg pr-md fill-base b-1px-t">
				<view class="f-title c-title">额度管理</view>
				<view class="flex-y-center f-paragraph c-title">
					<i class="iconfont icon-right ml-sm"></i>
				</view>
			</view>
		</block>
		
		
		<view class="space-footer"></view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	import siteInfo from '@/siteinfo.js';
	let timer = null
	export default {
		data() {
			return {
				isLoad: false,
				detail: {},
				tabList: [
					{name: '总资产（元）',number: 0 , type: 'balance'},
					{name: '累计充值（元）',number: 0, type: 'recharge_balance'},
					{name: '累计消费（元）',number: 0, type: 'consume_money'}
				]
			}
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo
		}),
		async onLoad(options) {
			this.$util.showLoading()
			this.initIndex()
		},
		async onPullDownRefresh() {
			// #ifndef APP-PLUS
			uni.showNavigationBarLoading()
			// #endif
			this.initRefresh();
			uni.stopPullDownRefresh()
		},
		methods: {
			...mapActions(['getConfigInfo']),
			...mapMutations(['updatePoolItem', 'updateHomeItem']),
			async initIndex(refresh = false){
				if(!this.configInfo.id || refresh){
					this.getConfigInfo()
				}
				this.getDetail()
			},
			async initRefresh(){
				this.$util.showLoading()
				this.initIndex(true)
			},
			async getDetail(){
				let data = await this.$api.user.companyInfo()
				this.detail = data
				this.isLoad = true
				this.$util.hideAll()
			},
			async submit(id){}
		},
	}
</script>


<style lang="scss">
	.pages-box {
		.mine-menu-list {
			.money-info {
				font-size: 50rpx;
				
				.money {
					font-size: 70rpx;
				}
			}
				
			.cash-out-btn {
				height: 88rpx;
				border-radius: 88rpx;
			}
				
			.menu-title {
				height: 90rpx;
				
				.iconfont {
					font-size: 24rpx;
				}
			}
				
			.item-child {
				width: 25%;
				margin: 10rpx 0;
				
				.iconfont {
					font-size: 46rpx;
				}
			}
				
				
		}
				
				
		.money-count {
			.item-child {
				width: 50%;
			}
		}
	}
</style>
